// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗  
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝  
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// -----------------------------------------------
//  
// This file is automatically generated 
// Please do not edit these files manually
// Run the following in the root of the repos:
//
// 		*NIX 		:	./build.sh codegen
// 		Windows 	:	build.bat codegen
//
// -----------------------------------------------
// ReSharper disable RedundantUsingDirective
using System;
using System.Threading;
using System.Threading.Tasks;
using Elasticsearch.Net.Specification.AsyncSearchApi;

// ReSharper disable once CheckNamespace
// ReSharper disable RedundantTypeArgumentsOfMethod
namespace Nest.Specification.AsyncSearchApi
{
	///<summary>
	/// Async Search APIs.
	/// <para>Not intended to be instantiated directly. Use the <see cref = "IElasticClient.AsyncSearch"/> property
	/// on <see cref = "IElasticClient"/>.
	///</para>
	///</summary>
	public class AsyncSearchNamespace : NamespacedClientProxy
	{
		internal AsyncSearchNamespace(ElasticClient client): base(client)
		{
		}

		/// <summary>
		/// <c>DELETE</c> request to the <c>async_search.delete</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchDeleteResponse Delete(Id id, Func<AsyncSearchDeleteDescriptor, IAsyncSearchDeleteRequest> selector = null) => Delete(selector.InvokeOrDefault(new AsyncSearchDeleteDescriptor(id: id)));
		/// <summary>
		/// <c>DELETE</c> request to the <c>async_search.delete</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchDeleteResponse> DeleteAsync(Id id, Func<AsyncSearchDeleteDescriptor, IAsyncSearchDeleteRequest> selector = null, CancellationToken ct = default) => DeleteAsync(selector.InvokeOrDefault(new AsyncSearchDeleteDescriptor(id: id)), ct);
		/// <summary>
		/// <c>DELETE</c> request to the <c>async_search.delete</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchDeleteResponse Delete(IAsyncSearchDeleteRequest request) => DoRequest<IAsyncSearchDeleteRequest, AsyncSearchDeleteResponse>(request, request.RequestParameters);
		/// <summary>
		/// <c>DELETE</c> request to the <c>async_search.delete</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchDeleteResponse> DeleteAsync(IAsyncSearchDeleteRequest request, CancellationToken ct = default) => DoRequestAsync<IAsyncSearchDeleteRequest, AsyncSearchDeleteResponse>(request, request.RequestParameters, ct);
		/// <summary>
		/// <c>GET</c> request to the <c>async_search.get</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchGetResponse<TDocument> Get<TDocument>(Id id, Func<AsyncSearchGetDescriptor, IAsyncSearchGetRequest> selector = null)
			where TDocument : class => Get<TDocument>(selector.InvokeOrDefault(new AsyncSearchGetDescriptor(id: id)));
		/// <summary>
		/// <c>GET</c> request to the <c>async_search.get</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchGetResponse<TDocument>> GetAsync<TDocument>(Id id, Func<AsyncSearchGetDescriptor, IAsyncSearchGetRequest> selector = null, CancellationToken ct = default)
			where TDocument : class => GetAsync<TDocument>(selector.InvokeOrDefault(new AsyncSearchGetDescriptor(id: id)), ct);
		/// <summary>
		/// <c>GET</c> request to the <c>async_search.get</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchGetResponse<TDocument> Get<TDocument>(IAsyncSearchGetRequest request)
			where TDocument : class => DoRequest<IAsyncSearchGetRequest, AsyncSearchGetResponse<TDocument>>(request, request.RequestParameters);
		/// <summary>
		/// <c>GET</c> request to the <c>async_search.get</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchGetResponse<TDocument>> GetAsync<TDocument>(IAsyncSearchGetRequest request, CancellationToken ct = default)
			where TDocument : class => DoRequestAsync<IAsyncSearchGetRequest, AsyncSearchGetResponse<TDocument>>(request, request.RequestParameters, ct);
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchSubmitResponse<TDocument> Submit<TInferDocument, TDocument>(Func<AsyncSearchSubmitDescriptor<TInferDocument>, IAsyncSearchSubmitRequest> selector = null)
			where TInferDocument : class where TDocument : class => Submit<TDocument>(selector.InvokeOrDefault(new AsyncSearchSubmitDescriptor<TInferDocument>()));
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchSubmitResponse<TDocument>> SubmitAsync<TInferDocument, TDocument>(Func<AsyncSearchSubmitDescriptor<TInferDocument>, IAsyncSearchSubmitRequest> selector = null, CancellationToken ct = default)
			where TInferDocument : class where TDocument : class => SubmitAsync<TDocument>(selector.InvokeOrDefault(new AsyncSearchSubmitDescriptor<TInferDocument>()), ct);
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchSubmitResponse<TDocument> Submit<TDocument>(Func<AsyncSearchSubmitDescriptor<TDocument>, IAsyncSearchSubmitRequest> selector = null)
			where TDocument : class => Submit<TDocument>(selector.InvokeOrDefault(new AsyncSearchSubmitDescriptor<TDocument>()));
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchSubmitResponse<TDocument>> SubmitAsync<TDocument>(Func<AsyncSearchSubmitDescriptor<TDocument>, IAsyncSearchSubmitRequest> selector = null, CancellationToken ct = default)
			where TDocument : class => SubmitAsync<TDocument>(selector.InvokeOrDefault(new AsyncSearchSubmitDescriptor<TDocument>()), ct);
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public AsyncSearchSubmitResponse<TDocument> Submit<TDocument>(IAsyncSearchSubmitRequest request)
			where TDocument : class => DoRequest<IAsyncSearchSubmitRequest, AsyncSearchSubmitResponse<TDocument>>(request, request.RequestParameters);
		/// <summary>
		/// <c>POST</c> request to the <c>async_search.submit</c> API, read more about this API online:
		/// <para></para>
		/// <a href = "https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html">https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html</a>
		/// </summary>
		public Task<AsyncSearchSubmitResponse<TDocument>> SubmitAsync<TDocument>(IAsyncSearchSubmitRequest request, CancellationToken ct = default)
			where TDocument : class => DoRequestAsync<IAsyncSearchSubmitRequest, AsyncSearchSubmitResponse<TDocument>>(request, request.RequestParameters, ct);
	}
}